package com.demo.widget.meis;


import com.demo.widget.BaseAbility;
import com.demo.widget.ResourceTable;
import com.meis.widget.evaporate.EvaporateTextView;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;

/**
 * Created by wenshi on 2018/11/23.
 * Description
 */
public class MeiEvaporateAbility extends BaseAbility {

    private EvaporateTextView mEvaporateTextView;
    private int index = 0;

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_mei_evaporate_ability);
        mEvaporateTextView = (EvaporateTextView) findComponentById(ResourceTable.Id_etv);
        Button mBtn = (Button) findComponentById(ResourceTable.Id_btn);
        mBtn.setClickedListener(component -> {
            if (index >= (sentences.length - 1)) {
                index = 0;
            }
            mEvaporateTextView.animateText(sentences[index++]);
        });
        mEvaporateTextView.animateText("hello world");
    }

    private String[] sentences = {
            "A material",
            "metaphor is the unifying theory",
            "of a rationalized space and a system of motion",
            "material",
            "grounded",
            "in tactile reality",
            "inspired",
            "study of paper and ink",
            "understand",
            "new affordances",
            "The fundamentals of light, surface, and movement are key to conveying how objects move",
            "interact",
            "divides space",
            "fundamentals",
            "欢迎关注",
            "控件人生",
            "公众号"
    };
}
